/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jas.bank;

import http.rpc.RemoteException;
import http.rpc.RemoteObject;
import http.rpc.RpcClient;

/**
 *
 * @author Asger
 */
public class Account_Stub implements Account {
    
    private RemoteObject obj;
    private RpcClient client;
    
    public Account_Stub(RemoteObject obj, RpcClient client) {
        this.obj = obj;
        this.client = client;
    }

    public String getName() throws RemoteException {
        return client.remoteCall(String.class, obj.getId(), "getName", new Object[0]);
    }

    public double getBalance() throws RemoteException {
        return client.remoteCall(Double.class, obj.getId(), "getBalance", new Object[0]);
    }

    public void deposit(Double amount) throws RemoteException {
       client.remoteCall(null, obj.getId(), "deposit", new Object[] {amount});
    }

    public void withdraw(Double amount) throws RemoteException {
       client.remoteCall(null, obj.getId(), "withdraw", new Object[] {amount});
    }
    
}
